from openpyxl.workbook import Workbook

wb = Workbook()
ws = wb.active

# 合并
ws.merge_cells('A2:D2')
# 取消合并
ws.unmerge_cells('A2:D2')

# or equivalently
ws.merge_cells(start_row=2, start_column=1, end_row=4, end_column=4)
ws.unmerge_cells(start_row=2, start_column=1, end_row=4, end_column=4)
